//
//  main.cpp
//  Yallok_1
//
//  Created by 종헌 백 on 12. 1. 31..
//  Copyright (c) 2012년 backssi1@naver.com. All rights reserved.
//

#include <iostream>
#include <ctime>
#include <stdlib.h>

using namespace std;

void arrya_number ( int *a );

int main()
{
    
    srand((unsigned)time(NULL));

    int usernumber;
    int i,j;
    int n = 1;
    
    cout<<"PutNumber N :";
    cin>>usernumber;
    cout<<endl;
    
    
    for ( i = 0 ; i < usernumber ; i ++ )
    {
        n = 2 * n;
    }
    
    cout<<" 2^N 만큼 랜던 숫자 출력"<<endl;
    
    int *Number = new int[n];

    for ( i = 0 ; i < n ; i++ )
    {
        Number[i] = rand()%100+1;
        for ( j = 0 ; j < i ; j++ )
        {
            if ( Number[i] == Number[j] )
                i--;
            break;
        }
    }
    
    array_number ( int Number );
    
    cout<<" 정렬 숫자 출력 "<<endl;

    
    
    
    delete Number;
    
    
}

void array_number ( int *a )
{
    int temp;
    int i,j;
    
    for ( i = 0 ; i < 6 ; i++ )
    {
        for ( j = 0 ; j < i ; j++ )
            if ( a[i] < a[j] )
            {
                temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
    }
}

